package custom_class;

import java.util.Comparator;

/**
 * @author wenyuan
 * @version 1.0
 * @date 2023/7/21
 * @since 8
 */
public class PersonComparator implements Comparator<Person> {

    @Override
    public int compare(Person o1, Person o2) {
        if(o1.getAge() > o2.getAge())
            return 1;
        else if(o1.getAge() < o2.getAge()) return -1;
        else return 0;
    }
}
